/**
 * @author Tran
 */
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/*
 * this panel is the stage gui for creating
 * a new account to be added to the system
 */

public class panelcreate extends JPanel
{
	/*
	 * createNew is the button for creating a new account
	 * backmenu will be the button that takes you back to the
	 * main menu
	 * 
	 * userpw will be where the new acconnt password is type
	 * same for username
	 * userpw_re will be to check if both passwords are the same
	 */
	blankButton createNew, backmenu;
	JTextField username;
	JPasswordField userpw;
	JPasswordField userpw_re;
	
	
	
	public panelcreate() 
	{
		//creating a gridbaglayout
		//adding textfields and buttons
		this.setLayout(new GridBagLayout());
		GridBagConstraints c = new GridBagConstraints();
		
		Font font = new Font("Ubuntu Mono", Font.BOLD, 16);
		
		c.insets = new Insets(40,0,5,5);
		c.gridy = 0;
		
		username = new JTextField();
		JLabel userlabel = new JLabel("Username: ");
		userlabel.setFont(font);
		
		username.setPreferredSize(new Dimension(200, 30));
		this.add(userlabel, c);
		this.add(username, c);
		
		c.insets = new Insets(0, 0, 5, 5);
		c.gridy = 1;
		
		userpw = new JPasswordField();
		userpw_re = new JPasswordField();
		JLabel pwlabel = new JLabel("Password: ");
		JLabel pwlabel_re = new JLabel("Retype Password: ");
		userpw.setPreferredSize(new Dimension(200,30));
		userpw_re.setPreferredSize(new Dimension(200, 30));
		pwlabel.setFont(font);
		pwlabel_re.setFont(font);
		
		this.add(pwlabel, c);
		this.add(userpw, c);
		c.gridy = 2;
		this.add(pwlabel_re, c);
		this.add(userpw_re, c);
		
		c.gridy = 3;
		createNew = new blankButton("Create Account");
		backmenu = new blankButton("Back");
		createNew.setFont(font);
		backmenu.setFont(font);
		this.add(createNew, c);
		this.add(backmenu, c);
		
		
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) 
	{
		// TODO Auto-generated method stub

	}
	
	public void paintComponent(Graphics g) 
	{
		
		Graphics2D g2 = (Graphics2D) g;
		GradientPaint p;
		p = new GradientPaint(0, 50, Color.WHITE, 0, getHeight()*2,new Color(123,53,153));//variation of purple RGB

		Paint oldPaint = g2.getPaint();
		g2.setPaint(p);
		g2.fillRect(0, 0, 800, 600);
		g2.setPaint(oldPaint);
		g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
	 }

}
